/*
 * Copyright 2023 OpenSPG Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied.
 */

package com.antgroup.openspg.server.infra.dao.mapper;

import com.antgroup.openspg.server.infra.dao.dataobject.AccountDO;
import java.util.Collection;
import java.util.List;
import org.apache.ibatis.annotations.Param;

public interface AccountMapper {
  /**
   * This method was generated by MyBatis Generator. This method corresponds to the database table
   * kg_user
   *
   * @param record com.antgroup.openspg.server.infra.dao.dataobject.AccountDO
   * @return int
   */
  int insert(AccountDO record);

  /**
   * This method was generated by MyBatis Generator. This method corresponds to the database table
   * kg_user
   *
   * @param record com.antgroup.openspg.server.infra.dao.dataobject.AccountDO
   * @return int
   */
  int updateByPrimaryKeySelective(AccountDO record);

  /**
   * update by userNo
   *
   * @param record com.antgroup.openspg.server.infra.dao.dataobject.AccountDO
   * @return int
   */
  int updateByUserNo(AccountDO record);

  /**
   * delete by userNo
   *
   * @param userNo java.lang.String
   * @return int
   * @param userNo
   * @return
   */
  int deleteByUserNo(@Param("userNo") String userNo);

  /**
   * This method was generated by MyBatis Generator. This method corresponds to the database table
   * kg_user
   *
   * @param id java.lang.Long
   * @return com.antgroup.openspg.server.infra.dao.dataobject.AccountDO
   */
  AccountDO selectByPrimaryKey(Long id);

  AccountDO getByUserId(String userNo);

  /**
   * batch get simple user by userNo list
   *
   * @param userNos
   * @return
   */
  List<AccountDO> getSimpleAccountByUserNoList(@Param("userNos") Collection<String> userNos);

  /**
   * get user by userNo or domainNo or name
   *
   * @param keyWord
   * @return
   */
  List<AccountDO> getUserLikeUserNoOrDomainNoOrName(@Param("keyWord") String keyWord);

  /**
   * select count account by condition
   *
   * @param accountDO
   * @return
   */
  Integer selectCountByCondition(AccountDO accountDO);

  /**
   * select account by condition
   *
   * @param accountDO
   * @param start
   * @param size
   * @return
   */
  List<AccountDO> selectByCondition(
      @Param("record") AccountDO accountDO, @Param("start") int start, @Param("size") int size);

  /**
   * update user config
   *
   * @param userNo
   * @param config
   * @return
   */
  int updateUserConfig(@Param("userNo") String userNo, @Param("config") String config);
}
